<?php

	// CONFIG

	$xcart = "http://www.locamedic.com/test/cat/";
	$xcartlink = "{$xcart}home.php?sl={$lg}";
	$xcartlogin = "{$xcart}error_message.php?need_login&sl={$lg}";
	$xcartorders = "{$xcart}cart.php?sl={$lg}";
	$xcartsearch = "{$xcart}search.php?sl={$lg}";
	$default_lang = "FR";

	include('open_db.inc');

	foreach($_POST AS $key => $value) {
	    ${$key} = $value;
	}

	foreach($_GET AS $key => $value) {
	    ${$key} = $value;
	}

	if($lg == "") $lg = "FR";
	if(!is_numeric($a)) $a = 1;

	if ($a != 1) 
		include('header2.php');
	else
		include('header.php');


	if(is_numeric($b))
		$sql = "SELECT id, name, html_$lg FROM `content` WHERE id = $b";
	else
		$sql = "SELECT id, name_$lg, html_$lg FROM `pages` WHERE id = $a";

	$query = mysql_query($sql, $db);
	$data = mysql_fetch_row($query);

	$data[2] = str_replace("{lg}", $lg, $data[2]);
	if($a == 6) {
		$sql = "SELECT id, name_$lg from `faq_cat` ORDER BY manorder";
		$query = mysql_query($sql, $db);
		$faqhtml = '';
		while($faqinfo  = mysql_fetch_row($query)) {
			$faqhtml .= '<li><a href="?a='.$a.'&lg='.$lg.'&cat='.$faqinfo[0].'">'.$faqinfo[1].'</a>';
		}
		$data[2] = str_replace("{faqcat}", $faqhtml, $data[2]);
	
		if(!is_numeric($cat)) $cat = 1;
		
		$sql = "SELECT q_$lg, r_$lg from `faq_entries` ORDER BY manorder";
		$query = mysql_query($sql, $db);
		$faqhtml = '';
		while($faqinfo = mysql_fetch_row($query)) {
			$faqhtml .= '<p><span class="texthd2blk">'.$faqinfo[0].'</span></p>';
			$faqhtml .= '<p><span class="text">'.$faqinfo[1].'</span></p>'; 
		}
		$data[2] = str_replace("{faqentries}", $faqhtml, $data[2]);
	}

	echo $data[2];

	include('footer.php');

?>
